package com.dhcc.his.web.rest.student;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.dhcc.framework.common.PageModel;
import com.dhcc.his.blh.student.StudentBlh;
import com.dhcc.his.dto.student.StudentDto;

/**
* 
* <p>标题: {$businessName}Controller.java</p>
* <p>业务描述: 请在这里写上你的业务描述</p>
* 公司:东华医为科技有限公司<br/>
* <p>版权: dhcc2019</p>
* @author: {$GenAuthor}
* @date: {$GenDate}
* @version: V1.0
*/
 
@RestController
@RequestMapping("/dhccApi/student/student")
public class StudentRest {

	@Resource
	private StudentBlh studentBlh;

	@PostMapping(value="page",consumes="application/json")
	public PageModel pageRest(@RequestBody(required=false) StudentDto dto) {
		return this.page(dto);
	}
	@RequestMapping("page")
	public PageModel page(StudentDto dto) {
		studentBlh.page(dto);
		return dto.getPageModel();
	}

	@PostMapping(value="save",consumes="application/json")
	public StudentDto saveRest(@RequestBody StudentDto dto) {
		return this.save(dto);
	}
	@RequestMapping("save")
	public StudentDto save(StudentDto dto) {
		studentBlh.save(dto);
		return dto;
	}
	
	@PostMapping(value="deleteById",consumes="application/json")
	public StudentDto deleteByIdRest(@RequestBody StudentDto dto) {
		return this.deleteById(dto);
	}
	@DeleteMapping("deleteById")
	public StudentDto deleteById(StudentDto dto) {
		studentBlh.deleteById(dto);
		return dto;
	}
	
	@PostMapping(value="findById",consumes="application/json")
	public StudentDto findByIdRest(@RequestBody StudentDto dto) {
		return this.findById(dto);
	}
	@GetMapping("findById")
	public StudentDto findById(StudentDto dto) {
		studentBlh.findById(dto);
		return dto;
	}
}
